package com.handler.banner;

import com.dao.mapper.Banner;
import com.handler.exception.BannerException;
import com.service.banner.BannerService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@RequestMapping("/banner")
@Controller
public class BannerController {

    @RequestMapping(value = "/{id}",method = RequestMethod.GET)
    public @ResponseBody Banner getBannerAll(@PathVariable Integer id) throws BannerException {
        Banner result = BannerService.getAll(id);
        if(result == null){
            throw new BannerException();
        }
        return result;
    }
}
